package com.bw.module_cinema.model.dialog

import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager
import com.bw.module_cinema.databinding.DialogNewTypeBinding
import com.bw.module_cinema.model.adapter.NewTypeAdapter
import com.bw.module_cinema.model.entity.VideoTypeEntity

class TypeDialog(context: Context):Dialog(context) {
    private lateinit var binding: DialogNewTypeBinding
    private lateinit var newAdapter: NewTypeAdapter

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        // 初始化绑定
        binding = DialogNewTypeBinding.inflate(layoutInflater)
        setContentView(binding.root)
        // 初始化新列表适配器
        newAdapter = NewTypeAdapter()
        binding.rvDialogType.layoutManager = LinearLayoutManager(context)
        binding.rvDialogType.adapter = newAdapter
        // 设置弹窗样式（如宽度、动画）
        window?.setLayout(
            (context.resources.displayMetrics.widthPixels * 0.8).toInt(), // 宽度为屏幕80%
            LinearLayout.LayoutParams.WRAP_CONTENT
        )
        window?.setWindowAnimations(android.R.style.Animation_Dialog) // 添加入场动画
    }
}